<template lang="html">
  <div class="mine-user clear-fix">
    <div v-if='isLogin' class="mine-user-box">
      <div class="mine-user-img">
        <img :src="userImg" alt="">
      </div>
      <div class="mine-user-username">{{ userinfo.username }}</div>
    </div>
    <div v-else class="mine-user-box">
      <router-link tag='div' to='/login' class="mine-user-username">未登录</router-link>
    </div>
    <div class="mine-user-right">
      <router-link tag='span' to='/information'>健康信息</router-link>
      <i class="mine-arror">></i>
    </div>
  </div>
</template>

<script>
export default {
  name:'MineUserInfo',
  data(){
      return{
        userImg: require('../../assets/img/mine/mine_img_07.png')
      }
  },
  props:{
    userinfo:{
      type:Object,
      default:function(){
        return {}
      }
    }
  },
  computed:{
    isLogin(){
      if(this.userinfo.username && this.userinfo.password){
        return true
      }else {
        return false
      }
    }
  }
}
</script>

<style lang="less" scoped>
.mine-user{
  margin: 0.46rem 0;
  padding: 0.1em 0.2rem;
  background-color: #fff;
  height: 1.14rem;
  line-height: 1.14rem;
  font-size: 0.26rem;
  .mine-user-img{
    width: 1.14rem;
    float: left;
    img{
      width: 100%;
    }
  }
  .mine-user-username{
    float: left;
    height: 100%;
    margin-left: 0.2rem;
  }
  .mine-user-right{
    float: right;
    color: #6c6c6c;
  }
}
</style>
